{% extends "base.html" %}

{% block body_content %}
<h1>Lista por média diária de visitas</h1>

<div class="pagination">
  <a href="{% url 'result_archive' yesterday %}">Antes</a> |
  <span style="font-size:170%;">{{ today|date:"Y-m-d" }}</span> 
  {% if tomorrow %}| <a href="{% url 'result_archive' tomorrow %}">Depois</a>{% endif %}</p>
</div>

{% if page %}
<table>
<tr>
  <th>Pos.</th>
  <th>Nome</th>
  <th>Total Visitas</th>
  <th>Média Visitas</th>
  <th>Total Páginas</th>
  <th>Média Páginas</th>
</tr>
{% for stat in page %}
{% if stat.blog.id == highlight %}<tr style="background-color:yellow;">{% else %}<tr>{% endif %}
  <td align="right">{{ page.start_index|add:forloop.counter0 }}</td>
  <td><a href="{{ stat.blog.url }}" target="_blank">{{ stat.blog.name }}</a> (<a href="{{ stat.blog.sitemeter_url }}" target="_blank">sitemeter</a> | <a href="{% url 'blog_info' stat.blog.id %}">stats</a>)</td>
  <td align="right">{{ stat.visits_total }}</td>
  <td align="right">{{ stat.visits_daily_average }}</td>
  <td align="right">{{ stat.pages_total }}</td>
  <td align="right">{{ stat.pages_daily_average}}</td>
</tr>
{% endfor %}
</table>

<br>
{% include "pagination.html" %}
{% else %}
<p>Lamentamos mas não temos estatísticas para {{ today|date:"Y-m-d" }}.</p>
{% endif %} 
{% endblock %}
